//
//  FlowBoAttributes.m
//  万州V7宝iOS客户端[ObjC]
//
//  Created by DimChum_Haul on 16/3/13.
//  Copyright © 2016年 沙罗双树831. All rights reserved.
//

#import "FlowListObj.h"
#import "PostsAFN.h"

@interface FlowListObj ()
@property (assign) unsigned int ImageKeyDictCounter;
@property (strong ,atomic,readonly) NSMutableArray <NSString*>* ImageAryOfCommodity;
@property (strong ,atomic,readonly) NSMutableArray <NSDictionary*>* imageAryOfCommodityOrigenal;
@end

@implementation FlowListObj
- (NSMutableArray<NSString *> *)getImageAryOfFinalUrl{
    return self.ImageAryOfCommodity;
}

- (NSMutableArray<NSDictionary *> *)getImageAttributsAryOfFinalUrl{
    return self.imageAryOfCommodityOrigenal;
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        _ImageAryOfCommodity = [NSMutableArray arrayWithCapacity:20];
        _imageAryOfCommodityOrigenal = [NSMutableArray arrayWithCapacity:20];
        self.ImageKeyDictCounter = 0;
    }
    return self;
}

- (void)JsonImageAryCreateByV7Netting:(NSString *)oriStringOfEechArys
{
    if(!oriStringOfEechArys || oriStringOfEechArys.length == 0) return;
    
    __block NSArray* arrayEach = [oriStringOfEechArys componentsSeparatedByString:@";"];
    
    NSMutableArray *temp = [NSMutableArray array]; // url转换之后的真实url数组
    NSMutableArray *tempDict = [NSMutableArray new]; // [0-1] 1.img 2.img
    
    for (int idx = 0 ; idx < arrayEach.count; idx++) {
        NSString* eathString = (NSString*)arrayEach[idx];
        
        NSString* finalImageUrlString = [NSString stringWithFormat:@"%@/%@",[NSString stringWithFormat:@"%@:%@/VB",Domain_LBDS,PORT_LBDS],eathString];
        [temp addObject:finalImageUrlString];
        
        NSDictionary* descDictOfeachImages = @{[NSString stringWithFormat:@"%zd-%zd",self.ImageKeyDictCounter,idx]:finalImageUrlString};
        [tempDict addObject:descDictOfeachImages];
        [_ImageAryOfCommodity addObjectsFromArray:temp];
        [_imageAryOfCommodityOrigenal addObjectsFromArray:tempDict];
    }
    self.ImageKeyDictCounter++;
}

@end

